"""
@version:python3
@author:ll
@file:03-QObject-信号的操作-案例.py
@time:2022/2/8 3:03
"""
from PyQt5.Qt import *


class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("")
        self.resize(500, 500)
        self.setup_ui()

    def setup_ui(self):  # 添加子控件以及子控件的配置操作
        self.QObject_connect()
    def QObject_connect(self):
        # 任务一：点击显示“点我噶哈”
        # btn = QPushButton(self)
        # btn.setText("点击我")
        # def cao():
        #     print("点我嘎哈")
        # btn.clicked.connect(cao)

        pass
if __name__ == "__main__":
    import sys

    app = QApplication(sys.argv)
    # window = Window()
    window = QWidget()
    def cao(title):
        # print("标题变化了")
        # window.windowTitleChanged.disconnect(cao)
        window.blockSignals(True)
        window.setWindowTitle("撩课-" + title)
        window.blockSignals(False)
    window.windowTitleChanged.connect(cao)

    window.setWindowTitle("hello world")
    window.setWindowTitle("hello world2")

    window.show()

    sys.exit(app.exec_())
